//
//  AddLincenceTimeTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/8/15.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "AddLincenceTimeTableViewCell.h"

@implementation AddLincenceTimeTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.timeLabel];
    [self.contentView addSubview:self.startTimeBtn];
    [self.contentView addSubview:self.detailLabel];
    [self.contentView addSubview:self.endTimeBtn];
}

-(UILabel *)timeLabel
{
    if(_timeLabel == nil)
    {
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 18, WIDTH - 40, 20)];
        _timeLabel.font = font(16);
        _timeLabel.text = @"执照有效日期";
        _timeLabel.textColor = SFM51;
        _timeLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _timeLabel;
}

-(UIButton *)startTimeBtn
{
    if(_startTimeBtn == nil)
    {
        _startTimeBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, 58, 110, 20)];
        _startTimeBtn.titleLabel.font = font(14);
        [_startTimeBtn setTitleColor:SFM51 forState:UIControlStateNormal];
    }
    return _startTimeBtn;
}

-(UIButton *)endTimeBtn
{
    if(_endTimeBtn == nil)
    {
        _endTimeBtn = [[UIButton alloc] initWithFrame:CGRectMake(190, 58, 110, 20)];
        _endTimeBtn.titleLabel.font = font(14);
    }
    return _endTimeBtn;
}

-(UILabel *)detailLabel
{
    if(_detailLabel == nil)
    {
        _detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 58, 20, 20)];
        _detailLabel.font = font(14);
        _detailLabel.textColor = SFMColor(254, 101, 54);
        _detailLabel.textAlignment = NSTextAlignmentCenter;
        _detailLabel.text = @"至";
    }
    return _detailLabel;
}

-(void)sendStartTIme:(NSString *)startTime AndEndTime:(NSString *)endTime
{
    [self.startTimeBtn setTitle:startTime forState:UIControlStateNormal];
    NSString * endTimeStr = @"请选择结束日期";
    [self.endTimeBtn setTitle:endTime?endTime:endTimeStr forState:UIControlStateNormal];
    [self.endTimeBtn setTitleColor:endTime?SFM51:SFM153 forState:UIControlStateNormal];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
